package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TbProtocol;
import com.ruoyi.system.mapper.TbProtocolMapper;
import com.ruoyi.system.service.ITbProtocolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 协议Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-07
 */
@Service
public class TbProtocolServiceImpl implements ITbProtocolService 
{
    @Autowired
    private TbProtocolMapper tbProtocolMapper;

    /**
     * 查询协议
     * 
     * @param id 协议主键
     * @return 协议
     */
    @Override
    public TbProtocol selectTbProtocolById(Long id)
    {
        return tbProtocolMapper.selectTbProtocolById(id);
    }

    /**
     * 查询协议列表
     * 
     * @param tbProtocol 协议
     * @return 协议
     */
    @Override
    public List<TbProtocol> selectTbProtocolList(TbProtocol tbProtocol)
    {
        return tbProtocolMapper.selectTbProtocolList(tbProtocol);
    }

    /**
     * 新增协议
     * 
     * @param tbProtocol 协议
     * @return 结果
     */
    @Override
    public int insertTbProtocol(TbProtocol tbProtocol)
    {
        tbProtocol.setCreateTime(DateUtils.getNowDate());
        return tbProtocolMapper.insertTbProtocol(tbProtocol);
    }

    /**
     * 修改协议
     * 
     * @param tbProtocol 协议
     * @return 结果
     */
    @Override
    public int updateTbProtocol(TbProtocol tbProtocol)
    {
        tbProtocol.setUpdateTime(DateUtils.getNowDate());
        return tbProtocolMapper.updateTbProtocol(tbProtocol);
    }

    /**
     * 批量删除协议
     * 
     * @param ids 需要删除的协议主键
     * @return 结果
     */
    @Override
    public int deleteTbProtocolByIds(Long[] ids)
    {
        return tbProtocolMapper.deleteTbProtocolByIds(ids);
    }

    /**
     * 删除协议信息
     * 
     * @param id 协议主键
     * @return 结果
     */
    @Override
    public int deleteTbProtocolById(Long id)
    {
        return tbProtocolMapper.deleteTbProtocolById(id);
    }
}
